// 响应头中间件

module.exports =  async(ctx, next) => {
    //ctx：上下文 
    const contentType = 'application/json; charset=utf-8';
    ctx.set("Content-Type", contentType);
    // 跨域设置
    ctx.set("Access-Control-Allow-Origin", "*");
    ctx.set("Access-Control-Allow-Methods", "OPTIONS, GET, PUT, POST, DELETE");
    await next();
    console.log('第二层中间件');
}